<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ch="http://java.sun.com/jsf/composite/channel"
                xmlns:pa="http://java.sun.com/jsf/composite/paymentMethod"
                xmlns:au="http://java.sun.com/jsf/composite/autocomplete">

    <ui:define name="content">
        <h:form id="form">
            <p:panel id="pan1" styleClass="noBorder summeryBorder">
                <f:facet name="header" >
                    <p:outputLabel value="All Doctor View" />
                </f:facet>
                <p:panel>
                    <h:panelGrid columns="2" >
                        <p:selectOneRadio value="#{channelReportController.reportKeyWord.string}" 
                                          rendered="#{sessionController.loggedPreference.applicationInstitution eq 'Ruhuna'}">
                            <f:selectItem itemValue="0" itemLabel="All" />
                            <f:selectItem itemValue="1" itemLabel="Morning(Till 11.59 am)" />
                            <f:selectItem itemValue="2" itemLabel="Evening(After 12 noon)" />
                        </p:selectOneRadio>
                    </h:panelGrid>
                    <h:panelGrid columns="3" >
                       
                        <p:outputLabel value="With Agency" rendered="#{sessionController.loggedPreference.applicationInstitution eq 'Cooperative'}" styleClass="noPrintButton"/>
                        <p:selectBooleanCheckbox value="#{channelReportController.agncy}" rendered="#{sessionController.loggedPreference.applicationInstitution eq 'Cooperative'}" styleClass="noPrintButton"/>
                        <p:commandButton value="Process" action="#{channelReportController.createTotalDoctor()}" styleClass="noPrintButton" ajax="false">
                        </p:commandButton>
                        <p:commandButton value="Process(Scan)" action="#{channelReportController.createTotalDoctorScan()}" styleClass="noPrintButton" rendered="#{sessionController.loggedPreference.applicationInstitution eq 'Cooperative'}" ajax="false">
                        </p:commandButton>
                        <p:commandButton value="Print" action="#" styleClass="noPrintButton">
                            <p:printer target="pan1" />
                        </p:commandButton>
                        <p:commandButton value="Excel" action="#" ajax="false">
                            <p:dataExporter target="tbl" type="xls" fileName="all_doctor" />
                        </p:commandButton>
                    </h:panelGrid>
                </p:panel>
                <p:dataTable id="tbl" value="#{channelReportController.channelDoctors}" var="bs" sortBy="#{bs.common}" rowIndexVar="i" >
                    <f:facet name="header">
                        <p:outputLabel value="#{sessionController.loggedUser.institution.name}" style="fon"/><br></br>
                        <p:outputLabel value="#{sessionController.loggedUser.institution.address}"/><br></br>
                        <p:outputLabel value="Total Doctor Fees"/><br></br>
                        <p:outputLabel value="Date: "/>
                        <p:outputLabel value="#{commonController.currentDateTime}" >
                            <f:convertDateTime pattern="yyyy MMMM dd" />
                        </p:outputLabel>     
                    </f:facet>
                    <p:column headerText="Consultant" style="width: 10px!important;">
                        <f:facet name="header">
                            <p:outputLabel value="No" style="float: left;"/>
                        </f:facet>
                        <p:outputLabel value="#{i+1}" />
                    </p:column>
                    <p:column headerText="Consultant" style="width: 1000px!important;" sortBy="#{bs.consultant.person.name}">
                        <f:facet name="header">
                            <p:outputLabel value="Consultant" style="float: left;"/>
                        </f:facet>
                        <p:outputLabel value="#{bs.consultant.person.nameWithTitle}" />
                    </p:column>   
                    <p:column headerText="Not Paid Bill" styleClass="numberCol">
                        <p:outputLabel value="#{bs.notPaidBillCount}" >
                            <f:convertNumber pattern="#,##0"/>
                        </p:outputLabel>
                    </p:column>
                    <p:column headerText="Bill" styleClass="numberCol">
                        <p:outputLabel value="#{bs.billCount}" >
                            <f:convertNumber pattern="#,##0"/>
                        </p:outputLabel>
                    </p:column>
                    <p:column headerText="Cancel" styleClass="numberCol">
                        <p:outputLabel value="#{bs.billCanncelCount}" >
                            <f:convertNumber pattern="#,##0"/>
                        </p:outputLabel>
                    </p:column>
                    <p:column headerText="Refund" styleClass="numberCol">
                        <p:outputLabel value="#{bs.refundedCount}" >
                            <f:convertNumber pattern="#,##0"/>
                        </p:outputLabel>
                    </p:column>
                    <p:column headerText="Valid Patient" styleClass="numberCol" style="width: 150px!important;">
                        <p:outputLabel value="#{bs.billCount-(bs.billCanncelCount+bs.refundedCount)}" >
                            <f:convertNumber pattern="#,##0"/>
                        </p:outputLabel>
                    </p:column>
                    <p:column headerText="Total" styleClass="numberCol noPrintButton" sortBy="#{bs.billFee+bs.billCanncelFee+bs.refundFee}">
                        <p:outputLabel value="#{bs.billFee+bs.billCanncelFee+bs.refundFee}" >
                            <f:convertNumber pattern="##,###,##0.00" />
                        </p:outputLabel>
                        <f:facet name="footer">
                            <p:outputLabel value="#{channelReportController.total}" style="float: right;">
                                <f:convertNumber pattern="##,###,##0.00" />
                            </p:outputLabel>
                        </f:facet>
                    </p:column>
                </p:dataTable>
            </p:panel>
        </h:form>
    </ui:define>



</ui:composition>
